package com.yue.jmx.demo1;

import javax.management.*;
import java.lang.management.ManagementFactory;
import java.util.concurrent.TimeUnit;

/**
 * 功能描述: TODO <br/>
 * 创建时间: 2017/1/3<br/>
 *
 * @author QiuYang
 */
public class Main {
    public static void main(String[] args) throws MalformedObjectNameException, NotCompliantMBeanException, InstanceAlreadyExistsException, MBeanRegistrationException, InterruptedException {
        MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        ControllerMBean controller = new Controller();
        mBeanServer.registerMBean(controller, new ObjectName("MyappMBean:name=controller"));

        while (true){
            TimeUnit.SECONDS.sleep(5);
        }

    }
}
